﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using eTMS.Controllers;

namespace eTMS.Forms.Reports
{
    public partial class FrmThongKeHSTheoCoCauXaHoi : eTMS.Controls.BaseForm
    {
        public FrmThongKeHSTheoCoCauXaHoi()
        {
            InitializeComponent();
        }
        
        private DataSet dataSet;
        SinhVienController ctrl = new SinhVienController();
        private void btnView_Click(object sender, EventArgs e)
        {
            dataSet = new DataSet();
            htmlReportViewer1.ReportDocument.Parameters.Clear();
            switch (cbkLoai.SelectedIndex)
            {
                case 0://Dân tộc
                    htmlReportViewer1.ReportDocument.Parameters.Add("TENBAOCAO", "DÂN TỘC");
                    htmlReportViewer1.ReportDocument.Parameters.Add("TIEUDETIEUCHI", "Dân tộc");
                    dataSet = ctrl.ThongKeSinhVienTheoDanToc(treeKhoaNganhKhoaHoc1.SelectedKhoa_ID, treeKhoaNganhKhoaHoc1.SelectedNganhHoc_ID, treeKhoaNganhKhoaHoc1.SelectedLop_ID, treeKhoaNganhKhoaHoc1.KhoaHoc_ID);
                    break;
                case 1://Tôn giáo
                    htmlReportViewer1.ReportDocument.Parameters.Add("TENBAOCAO", "TÔN GIÁO");
                    htmlReportViewer1.ReportDocument.Parameters.Add("TIEUDETIEUCHI", "Tôn giáo");
                    dataSet = ctrl.ThongKeSinhVienTheoTonGiao(treeKhoaNganhKhoaHoc1.SelectedKhoa_ID, treeKhoaNganhKhoaHoc1.SelectedNganhHoc_ID, treeKhoaNganhKhoaHoc1.SelectedLop_ID, treeKhoaNganhKhoaHoc1.KhoaHoc_ID);

                    break;
                case 2://Giới tính
                    htmlReportViewer1.ReportDocument.Parameters.Add("TENBAOCAO", "GIỚI TÍNH");
                    htmlReportViewer1.ReportDocument.Parameters.Add("TIEUDETIEUCHI", "Giới tính"); 
                    dataSet = ctrl.ThongKeSinhVienTheoGioiTinh(treeKhoaNganhKhoaHoc1.SelectedKhoa_ID, treeKhoaNganhKhoaHoc1.SelectedNganhHoc_ID, treeKhoaNganhKhoaHoc1.SelectedLop_ID, treeKhoaNganhKhoaHoc1.KhoaHoc_ID);
               
                    break;
                case 3://Đối tượng trợ cấp
                    htmlReportViewer1.ReportDocument.Parameters.Add("TENBAOCAO", "ĐỐI TƯỢNG TRỢ CẤP");
                    htmlReportViewer1.ReportDocument.Parameters.Add("TIEUDETIEUCHI", "Đối tượng");
                    dataSet = ctrl.ThongKeSinhVienTheoDoiTuongTroCap(treeKhoaNganhKhoaHoc1.SelectedKhoa_ID, treeKhoaNganhKhoaHoc1.SelectedNganhHoc_ID, treeKhoaNganhKhoaHoc1.SelectedLop_ID, treeKhoaNganhKhoaHoc1.KhoaHoc_ID);
           
                    break;
                case 4://Vùng miền
                    htmlReportViewer1.ReportDocument.Parameters.Add("TENBAOCAO", "VÙNG MIỀN");
                    htmlReportViewer1.ReportDocument.Parameters.Add("TIEUDETIEUCHI", "Vùng miền");
                    dataSet = ctrl.ThongKeSinhVienTheoKhuVuc(treeKhoaNganhKhoaHoc1.SelectedKhoa_ID, treeKhoaNganhKhoaHoc1.SelectedNganhHoc_ID, treeKhoaNganhKhoaHoc1.SelectedLop_ID, treeKhoaNganhKhoaHoc1.KhoaHoc_ID);
           
                    break;
            }
            SystemControllers.ReportHelper.AddHtmlReportParams(htmlReportViewer1.ReportDocument.Parameters);
            htmlReportViewer1.LoadReport(SystemControllers.ReportHelper.GetReportPath("18_ThongKeSinhVienTheoCoCauXaHoi.htm"));
            htmlReportViewer1.ReportDocument.DataSource = dataSet;
            htmlReportViewer1.ShowReport();
        }
    }
}
